import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'models/payment_intent.dart';
import 'stripe_connection_plugin_method_channel.dart';

abstract class StripeConnectionPluginPlatform extends PlatformInterface {
  /// Constructs a StripeConnectionPluginPlatform.
  StripeConnectionPluginPlatform() : super(token: _token);

  static final Object _token = Object();

  static StripeConnectionPluginPlatform _instance = MethodChannelStripeConnectionPlugin();

  /// The default instance of [StripeConnectionPluginPlatform] to use.
  ///
  /// Defaults to [MethodChannelStripeConnectionPlugin].
  static StripeConnectionPluginPlatform get instance => _instance;

  /// Platform-specific implementations should set this with their own
  /// platform-specific class that extends [StripeConnectionPluginPlatform] when
  /// they register themselves.
  static set instance(StripeConnectionPluginPlatform instance) {
    PlatformInterface.verifyToken(instance, _token);
    _instance = instance;
  }



  Future<void> init(String sn,String localId,String baseUrl,String errorUrl) async{
    _instance.init(sn, localId,baseUrl,errorUrl);
  }

  Future<void> cashBox(String cashBoxNum) async {
    _instance.cashBox(cashBoxNum);
  }

  Future<bool> openCash() async{
    return await _instance.openCash();
  }

  @override
  Future<void> disconnectReader() async{
    return await instance.disconnectReader();
  }


  @override
  Future<StripePaymentIntent> retrievePaymentIntent(String clientSecret) async{
    return await instance.retrievePaymentIntent(clientSecret);
  }

  @override
  Future<bool> cancelRetrievePaymentIntent() async{
    return await instance.cancelRetrievePaymentIntent();
  }

  @override
  Future<Map> processPayment() async{
    return await instance.processPayment();
  }

  @override
  Future<Map> cancelProcessPayment() async {
    Map map = await instance.cancelProcessPayment();
    return map;
  }
  @override
  Future<void> permissionAllowed() async{
    await instance.permissionAllowed();
  }
  @override
  Future<String> androidRequest() async{
    String string = await instance.androidRequest();
    return string;
  }





}
